package priv.pront.code.robot;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.StreamTokenizer;
import java.util.Arrays;

/**
 * @Description:
 * @Author: pront
 * @Time:2023-08-10 14:07
 */
public class P1744_采购特价商品 {


    static StreamTokenizer st = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));

    static int n, m;

    static int[] x, y;

    static double[][] dis;

    public static void main(String[] args) throws IOException {
        st.nextToken();
        n = (int) st.nval;
        x = new int[n + 1];
        y = new int[n + 1];
        dis = new double[n + 1][n + 1];
        for (int i = 1; i <= n; i++) {
            st.nextToken();
            x[i] = (int) st.nval;
            st.nextToken();
            y[i] = (int) st.nval;
        }

        st.nextToken();
        m = (int) st.nval;
        for (int i = 1; i <= n; i++) {
            Arrays.fill(dis[i], (int) 1e9);
        }

        for (int i = 0; i < m; i++) {
            st.nextToken();
            int a = (int) st.nval;
            st.nextToken();
            int b = (int) st.nval;
            int dx = Math.abs(x[a] - x[b]);
            int dy = Math.abs(y[a] - y[b]);
            double distantce = Math.sqrt(dx * dx + dy * dy);
            distantce = Double.parseDouble(String.format("%.2f", distantce));
            dis[a][b] = dis[b][a] = distantce;
        }

        for (int k = 1; k <= n; k++) {
            for (int i = 1; i <= n; i++) {
                for (int j = 1; j <= n; j++) {
                    dis[i][j] = Math.min(dis[i][k] + dis[k][j], dis[i][j]);

                }
            }
        }
        st.nextToken();
        int a = (int) st.nval;
        st.nextToken();
        int b = (int) st.nval;
        System.out.println(String.format("%.2f", dis[a][b]));
    }

}
